CIE: Simplify code
authorDebarshi Ray <debarshir@gnome.org>
Sat, 18 Nov 2017 01:09:03 +0000 (02:09 +0100)
committerDebarshi Ray <debarshir@gnome.org>
Sun, 26 Nov 2017 12:46:56 +0000 (13:46 +0100)
Exploit the fact that fy is not needed to calculate the a and b
components. This is consistent with the other monochrome conversions.

extensions/CIE.c

index 658fd2a8b304f2c2c9a6b87adaed18e47ccaa614..d5ed9eeca87843795baa5135036a3ccb224c4fe9 100644 (file)
@@ -713,10 +713,7 @@ rgbaf_to_Lf (const Babl *conversion,float *src,
       float b = src[2];
 
       float yr = m_1_0 * r + m_1_1 * g + m_1_2 * b;
-
-      float fy = yr > LAB_EPSILON ? _cbrtf (yr) : (LAB_KAPPA * yr + 16.0f) / 116.0f;
-
-      float L = 116.0f * fy - 16.0f;
+      float L = yr > LAB_EPSILON ? 116.0f * _cbrtf (yr) - 16 : LAB_KAPPA * yr;
 
       dst[0] = L;